index.module.css 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. .root {
  2. display: contents;
  3. [data-slot="messages"] {
  4. flex: 1;
  5. overflow-y: auto;
  6. display: flex;
  7. flex-direction: column;
  8. height: 0;
  9. /* This is important for flexbox to allow scrolling */
  10. font-family: var(--font-mono);
  11. color: var(--color-text);
  12. row-gap: var(--space-4);
  13. /* Add consistent spacing between messages */
  14. /* Remove top border for first user message */
  15. &>[data-component="message"][data-user]:first-child::before {
  16. display: none;
  17. }
  18. &:has([data-component="loading"]) [data-component="clear"] {
  19. display: none;
  20. }
  21. }
  22. [data-component="message"] {
  23. width: 100%;
  24. padding: var(--space-2) var(--space-4);
  25. line-height: var(--font-line-height);
  26. white-space: pre-wrap;
  27. align-self: flex-start;
  28. min-height: auto;
  29. /* Allow natural height for all messages */
  30. display: flex;
  31. flex-direction: column;
  32. align-items: flex-start;
  33. /* User message styling */
  34. &[data-user] {
  35. padding: var(--space-6) var(--space-4);
  36. position: relative;
  37. font-weight: 600;
  38. color: var(--color-text);
  39. /* margin: 0.5rem 0; */
  40. }
  41. &[data-user]::before,
  42. &[data-user]::after {
  43. content: "";
  44. position: absolute;
  45. left: var(--space-4);
  46. right: var(--space-4);
  47. height: var(--space-px);
  48. background-color: var(--color-border);
  49. z-index: 1;
  50. /* Ensure borders appear above other content */
  51. }
  52. &[data-user]::before {
  53. top: 0;
  54. }
  55. &[data-user]::after {
  56. bottom: 0;
  57. }
  58. &[data-assistant] {
  59. color: var(--color-text);
  60. }
  61. }
  62. [data-component="tool"] {
  63. display: flex;
  64. width: 100%;
  65. padding: 0 var(--space-4);
  66. margin-left: 0;
  67. flex-direction: column;
  68. opacity: 0.7;
  69. gap: var(--space-2);
  70. align-items: flex-start;
  71. color: var(--color-text-dimmed);
  72. min-height: auto;
  73. /* Allow natural height */
  74. [data-slot="header"] {
  75. display: flex;
  76. gap: var(--space-2);
  77. cursor: pointer;
  78. user-select: none;
  79. -webkit-user-select: none;
  80. align-items: center;
  81. width: 100%;
  82. }
  83. [data-slot="name"] {
  84. letter-spacing: -0.03125rem;
  85. text-transform: uppercase;
  86. font-weight: 500;
  87. font-size: var(--font-size-sm);
  88. }
  89. [data-slot="expand"] {
  90. font-size: var(--font-size-sm);
  91. }
  92. [data-slot="content"] {
  93. padding: 0;
  94. line-height: var(--font-line-height);
  95. font-size: var(--font-size-sm);
  96. white-space: pre-wrap;
  97. display: none;
  98. width: 100%;
  99. }
  100. [data-slot="output"] {
  101. margin-top: var(--space-1);
  102. }
  103. &[data-expanded="true"] [data-slot="content"] {
  104. display: block;
  105. }
  106. &[data-expanded="true"] [data-slot="expand"] {
  107. transform: rotate(45deg);
  108. }
  109. }
  110. [data-component="loading"] {
  111. padding: var(--space-4) var(--space-4) var(--space-8);
  112. height: 1.5rem;
  113. position: relative;
  114. display: flex;
  115. align-items: center;
  116. font-size: var(--font-size-sm);
  117. letter-spacing: var(--space-1);
  118. color: var(--color-text);
  119. & span {
  120. opacity: 0;
  121. animation: loading-dots 1.4s linear infinite;
  122. }
  123. & span:nth-child(2) {
  124. animation-delay: 0.2s;
  125. }
  126. & span:nth-child(3) {
  127. animation-delay: 0.4s;
  128. }
  129. }
  130. [data-component="clear"] {
  131. position: relative;
  132. padding: var(--space-4) var(--space-4);
  133. &::before {
  134. content: "";
  135. position: absolute;
  136. left: var(--space-4);
  137. right: var(--space-4);
  138. top: 0;
  139. height: var(--space-px);
  140. background-color: var(--color-border);
  141. z-index: 1;
  142. }
  143. & [data-component="button"] {
  144. padding-left: 0;
  145. }
  146. }
  147. [data-slot="footer"] {
  148. display: flex;
  149. flex-direction: column;
  150. padding: 0;
  151. border-top: 2px solid var(--color-border);
  152. position: sticky;
  153. bottom: 0;
  154. z-index: 10;
  155. /* Ensure it's above other content */
  156. margin-top: auto;
  157. /* Push to bottom if content is short */
  158. width: 100%;
  159. }
  160. [data-component="chat"] {
  161. display: flex;
  162. padding: var(--space-0-5) 0;
  163. align-items: center;
  164. width: 100%;
  165. height: 100%;
  166. textarea {
  167. --padding-y: var(--space-4);
  168. --line-height: 1.5;
  169. --text-height: calc(var(--line-height) * var(--font-size-lg));
  170. --height: calc(var(--text-height) + var(--padding-y) * 2);
  171. width: 100%;
  172. resize: none;
  173. line-height: var(--line-height);
  174. height: var(--height);
  175. min-height: var(--height);
  176. max-height: calc(5 * var(--text-height) + var(--padding-y) * 2);
  177. padding: var(--padding-y) var(--space-4);
  178. border-radius: 0;
  179. background-color: transparent;
  180. color: var(--color-text);
  181. border: none;
  182. outline: none;
  183. font-size: var(--font-size-lg);
  184. }
  185. textarea::placeholder {
  186. color: var(--color-text-dimmed);
  187. opacity: 0.75;
  188. }
  189. textarea:focus {
  190. outline: 0;
  191. }
  192. & [data-component="button"] {
  193. height: 100%;
  194. }
  195. }
  196. }
  197. @keyframes loading-dots {
  198. 0%,
  199. 100% {
  200. opacity: 0;
  201. }
  202. 40%,
  203. 60% {
  204. opacity: 1;
  205. }
  206. }